class Person:
    '''人类'''

    def __init__(self,name,weight):
        self.name=name
        self.weight=weight


    def run(self):
        print(f'{self.name}原有体重{self.weight}')
        self.weight -=5
        print(f'{self.name}跑步了，体重减去5公斤,现有体重{self.weight}')


    def eat(self):
        print(f'{self.name}原有体重{self.weight}')
        self.weight +=5
        print(f'{self.name}吃饭了，体重增加5公斤,现有体重{self.weight}')


    def __str__(self):
        return f'我的名字是{self.name},体重是{self.weight}'  # 注意是return，必须返回str类型，不能空

if __name__ == '__main__':
    elephant = Person('大象',80)

    elephant.run()

    elephant.eat()
    print(elephant)

    tiger = Person('老虎',45)
    tiger.eat()
    tiger.run()

